<?php
class UTEdge extends UnitTestCase {
    // Test of the limits of the Cubie construct
    function testConstruct() {
        try {
            $myEdge = new edge(0);
            $this->pass('EDGE type OK');
        }
        catch (Exception $e) {$this->fail();}

        try {
            $myEdge = new edge(edge::MAX_EDGE + 1);
            $this->fail('EDGE TYPE KO 1');
        }
        catch (Exception $e) {$this->pass();}

        try {
            $myEdge = new edge(-1);
            $this->fail('EDGE TYPE KO 2');
        }
        catch (Exception $e) {$this->pass();}

        try {
            $myEdge = new edge("stupid param");
            $this->fail('EDGE TYPE KO 3');
        }
        catch (Exception $e) {$this->pass();}

        try {
            $myEdge = new edge(0, 0);
            $this->pass('EDGE ORIENTATION OK 1');
        }
        catch (Exception $e) {$this->fail();}

        try {
            $myEdge = new edge(0, 1);
            $this->pass('EDGE ORIENTATION OK 2');
        }
        catch (Exception $e) {$this->fail();}

        try {
            $myEdge = new edge(0, -1);
            $this->fail('EDGE ORIENTATION KO 1');
        }
        catch (Exception $e) {$this->pass();}

        try {
            $myEdge = new edge(0, 2);
            $this->fail('EDGE ORIENTATION KO 2');
        }
        catch (Exception $e) {$this->pass();}
    }
    function testGetOrientation() {
        $myEdge = new edge(0, 0);
        $this->assertTrue($myEdge->getOrientation() === 0);
        $myEdge = new edge(0, 1);
        $this->assertTrue($myEdge->getOrientation() === 1);
    }
    function testToggleOrientation() {
        $myEdge = new edge(0, 0);
        $myEdge->toggleOrientation();
        $this->assertTrue($myEdge->getOrientation() === 1);
        $myEdge->toggleOrientation();
        $this->assertTrue($myEdge->getOrientation() === 0);
    }
}
?>